import request from '@/utils/request';
import qs from 'qs';
import type { ResponseData } from '../typing';
// 响应接口
export interface GetBasicSupplierPageRes {
    code: number;
    data: {
        size: number;
        total: number;
        records: {
            /* */
            createTime: Record<string, unknown>;
            /* */
            updateTime: Record<string, unknown>;
            /* */
            creator: number;
            /* */
            updater: number;
            /*主键 */
            id: number;
            /*供方名称 */
            name: string;
        }[];
        current: number;
        pages: number;
    };
    msg: string;
}
export interface QueryBasicSupplierParams {
    name: string;
    current: number;
    size: number;
}
/**
 * 获得供方分页
 * @param {string} name 供方名称
 * @param {string} current 当前第几页(默认1)
 * @param {string} size 每页条数(默认20)
 * @returns
 */
export function getBasicSupplierPage(params: Partial<QueryBasicSupplierParams>): Promise<GetBasicSupplierPageRes> {
    return request.get(`/yfwy/basic-supplier/page?${qs.stringify(params)}`);
}
// 响应接口
export interface GetBasicSupplierSelectListRes {
    /* */
    code: number;
    /* */
    data: {
        /* */
        createTime: Record<string, unknown>;
        /* */
        updateTime: Record<string, unknown>;
        /* */
        creator: number;
        /* */
        updater: number;
        /*主键 */
        id: number;
        /*供方名称 */
        name: string;
    }[];
    /* */
    msg: string;
}
/**
 * 获得供方列表
 * @returns
 */
export function getBasicSupplierSelectList(): Promise<GetBasicSupplierSelectListRes> {
    return request.get(`/openapi/basic/supplier`);
}
// 响应接口
export interface GetBasicSupplierRes {
    code: number;
    /* */
    data: {
        /* */
        createTime: Record<string, unknown>;
        /* */
        updateTime: Record<string, unknown>;
        /* */
        creator: number;
        /* */
        updater: number;
        /*主键 */
        id: number;
        /*供方名称 */
        name: string;
    };
    msg: string;
}

/**
 * 获得供方
 * @param {string} id
 * @returns
 */
export function getBasicSupplier(id: string): Promise<GetBasicSupplierRes> {
    return request.get(`/yfwy/basic-supplier/${id}`);
}
/**
 * 删除供方
 * @param {string} id
 * @returns
 */
export function deleteBasicSupplier(id: number): Promise<ResponseData<boolean>> {
    return request.delete(`/yfwy/basic-supplier/${id}`);
}
// 参数接口
export interface UpdateBasicSupplierParams {
    /*供方名称 */
    name: string;
    /*主键 */
    id: number;
}
/**
 * 更新供方
 * @param {object} params 管理后台 - 供方更新 Request VO
 * @param {string} params.name 供方名称
 * @param {number} params.id 主键
 * @returns
 */
export function updateBasicSupplier(params: UpdateBasicSupplierParams): Promise<ResponseData<boolean>> {
    return request.put(`/yfwy/basic-supplier`, params);
}

// 参数接口
export interface CreateBasicSupplierParams {
    /*供方名称 */
    name: string;
}
/**
 * 创建供方
 * @param {object} params 管理后台 - 供方创建 Request VO
 * @param {string} params.name 供方名称
 * @returns
 */
export function createBasicSupplier(params: CreateBasicSupplierParams): Promise<ResponseData<boolean>> {
    return request.post(`/yfwy/basic-supplier`, params);
}
